package com.adqua.testfacebook;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

public class ConfirmActivity extends Activity{
	
	TextView name_textView, id_textView;
	AlertDialog exit_alert;
	ArrayAdapter<CharSequence> adspin;
	
	@Override
	  public void onCreate(Bundle savedInstanceState) {
		
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.activity_confirm);
	    
	    Spinner spin = (Spinner) findViewById(R.id.cell_num1);
	    
	    adspin = ArrayAdapter.createFromResource(this, R.array.cell_select, android.R.layout.simple_spinner_item);
	    
	    adspin.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	    spin.setAdapter(adspin);
	    
	    spin.setOnItemSelectedListener(new OnItemSelectedListener() {
	    	public void onItemSelected(AdapterView<?> parent, View view, int position, long id){
	    		Toast.makeText(ConfirmActivity.this, adspin.getItem(position), Toast.LENGTH_SHORT).show();
	    	}

			@Override
			public void onNothingSelected(AdapterView<?> parent) {
				// TODO Auto-generated method stub
				
			}
		});
	    
	}
	
	@Override
	public void onBackPressed() {
		exit_alert = new AlertDialog.Builder(this).setTitle("").setMessage(
				"종료하시겠습니까?").setPositiveButton("ok",
				new DialogInterface.OnClickListener() {

					@Override
					public void onClick(DialogInterface dialog, int which) {
						// TODO Auto-generated method stub
						moveTaskToBack(true);
						finish();
						android.os.Process.killProcess(android.os.Process.myPid());
					}
				}).setNegativeButton("cancel", null).show();
	}

}
